package com.xp.basic.heima.nio.netty.simpledemo.chat.handler;

import com.xp.basic.heima.nio.netty.simpledemo.chat.message.RpcResponseMessage;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

@ChannelHandler.Sharable
public class RpcResponseHandler extends SimpleChannelInboundHandler<RpcResponseMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, RpcResponseMessage msg) throws Exception {
        if (null == msg.getExceptionValue()) {
            System.out.println("rpc success return value is  :"+ msg.getReturnValue());
        }else{
            System.out.println("rpc error   :"+ msg.getExceptionValue());
        }
    }
}
